<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title></title>
    <script src="../js/require.js"></script>
    <script src="./js/requireConfig.js"></script>
    <link rel="stylesheet" href="../js/Cesium/1.65/Build/Cesium/Widgets/widgets.css">
    <link rel="stylesheet" href="../css/common.css">
    <script>

        require([
            "uMap/uMap",
            "uEarth/uEarth",
            "mhjs/mhjs"
        ], function (uMap, uEarth, mhjs) {

            var earth = new uMap.Earth({
                objectOption: {
                    "container": "uMapApp_earthContainer"
                }
            });


            //地球设置
            earth.scene.globe.depthTestAgainstTerrain = true;
            earth.scene.postProcessStages.fxaa.enabled = false;

            //固定光照
            earth.clock.currentTime = uEarth.JulianDate.fromDate(new Date("2020/01/01 10:00:00"));
            earth.clock.clockRange = uEarth.ClockRange.CLAMPED;
            earth.clock.shouldAnimate = false;


            earth.imageryLayers.add(
                new uMap.ImageryLayer({
                    objectOption: {
                        imageryProvider: new uEarth.UrlTemplateImageryProvider({
                            url         : "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
                            maximumLevel: 17
                        })
                    }
                }).object
            );

            var positions = [
                [119.48013142708832, 32.440754895320865],
                [119.48378180499743, 32.44079267717115]
            ];

            var model = new uMap.ModelGraphic({
                objectOption: {
                    uri: "./data/bim/cargo_ship/scene.gltf"
                }
            });

            $.each(positions, function (i, position) {

                var entity = new uMap.Entity({
                    objectOption: {
                        position: position,
                        model   : model.object
                    }
                });

                earth.entities.add(entity.object);

            });

            earth.camera.flyToBoundingSphere(
                new uEarth.BoundingSphere(
                    new uMap.Position(positions[0]).cartesian,
                    100
                ),
                {
                    offset  : new uEarth.HeadingPitchRange(
                        uEarth.Math.toRadians(0),
                        uEarth.Math.toRadians(-90),
                        100
                    ),
                    duration: 1
                });


        });
    </script>

</head>
<body>
<div id="uMapApp_earthContainer" class="uMapApp_earthContainer"></div>
</body>
</html>